
package com.horizon.mobile.activity;

import zuo.biao.library.base.BaseFragment;
import zuo.biao.library.ui.AlertDialog.OnDialogButtonClickListener;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.horizon.mobile.R;

/**
 * 设置fragment
 *
 * @author 左大明
 */
public class WorkCenterFragment extends BaseFragment implements OnClickListener,
        OnDialogButtonClickListener {

    // 与Activity通信<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    static WorkCenterFragment fragment;

    /**
     * 创建一个Fragment实例
     *
     * @return
     */
    public static WorkCenterFragment createInstance() {
        if (fragment == null)
            fragment = new WorkCenterFragment();
        return fragment;
    }

    // 与Activity通信>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // 类相关初始化，必须使用<<<<<<<<<<<<<<<<
        super.onCreateView(inflater, container, savedInstanceState);
        setContentView(R.layout.work_center_list);
        // 类相关初始化，必须使用>>>>>>>>>>>>>>>>

        // 功能归类分区方法，必须调用<<<<<<<<<<
        initView();
        initData();
        initEvent();
        // 功能归类分区方法，必须调用>>>>>>>>>>

        return view;
    }

    // UI显示区(操作UI，但不存在数据获取或处理代码，也不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    private LinearLayout llGRDB, llDBRL, llDYSY, llYBSY, llYYSY, llKYSY, llYFQ,
            llCBWJ, llZZYJ, llYJ_YJS, llYJ_BJJ, llDJS, llJS_YJIES, llJS_YJUS,
            llGRDBSZ, llDBYJLB, llDBLSJL, llDBGZJS, llLCYJ, llSXYJ;

    @Override
    public void initView() {// 必须调用

        llGRDB = (LinearLayout) findViewById(R.id.llGRDB);
        llDBRL = (LinearLayout) findViewById(R.id.llDBRL);
        llDYSY = (LinearLayout) findViewById(R.id.llDYSY);
        llYBSY = (LinearLayout) findViewById(R.id.llYBSY);
        llYFQ = (LinearLayout) findViewById(R.id.llYFQ);
        llYYSY = (LinearLayout) findViewById(R.id.llYYSY);
        llKYSY = (LinearLayout) findViewById(R.id.llKYSY);
        llCBWJ = (LinearLayout) findViewById(R.id.llCBWJ);
        llLCYJ = (LinearLayout) findViewById(R.id.llLCYJ);
        llSXYJ = (LinearLayout) findViewById(R.id.llSXYJ);
        llZZYJ = (LinearLayout) findViewById(R.id.llZZYJ);
        llYJ_YJS = (LinearLayout) findViewById(R.id.llYJ_YJS);
        llYJ_BJJ = (LinearLayout) findViewById(R.id.llYJ_BJJ);
        llDJS = (LinearLayout) findViewById(R.id.llDJS);
        llJS_YJIES = (LinearLayout) findViewById(R.id.llJS_YJIES);
        llJS_YJUS = (LinearLayout) findViewById(R.id.llJS_YJUS);
        llGRDBSZ = (LinearLayout) findViewById(R.id.llGRDBSZ);
        llDBYJLB = (LinearLayout) findViewById(R.id.llDBYJLB);
        llDBLSJL = (LinearLayout) findViewById(R.id.llDBLSJL);
        llDBGZJS = (LinearLayout) findViewById(R.id.llDBGZJS);

    }


    // Data数据区(存在数据获取或处理代码，但不存在事件监听代码)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    @Override
    public void initData() {// 必须调用

    }

    // Event事件区(只要存在事件监听代码就是)<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    @Override
    public void initEvent() {// 必须调用

        llGRDB.setOnClickListener(this);
        llDBRL.setOnClickListener(this);
        llDYSY.setOnClickListener(this);
        llYBSY.setOnClickListener(this);
        llYFQ.setOnClickListener(this);
        llYYSY.setOnClickListener(this);
        llKYSY.setOnClickListener(this);
        llCBWJ.setOnClickListener(this);
        llLCYJ.setOnClickListener(this);
        llSXYJ.setOnClickListener(this);
        llZZYJ.setOnClickListener(this);
        llYJ_YJS.setOnClickListener(this);
        llYJ_BJJ.setOnClickListener(this);
        llDJS.setOnClickListener(this);
        llJS_YJIES.setOnClickListener(this);
        llJS_YJUS.setOnClickListener(this);
        llGRDBSZ.setOnClickListener(this);
        llDBYJLB.setOnClickListener(this);
        llDBLSJL.setOnClickListener(this);
        llDBGZJS.setOnClickListener(this);
    }

    @Override
    public void onDialogButtonClick(int requestCode, boolean isPositive) {
        if (!isPositive) {
            return;
        }

        switch (requestCode) {
            case 0:
                break;
            default:
                break;
        }
    }

    // 系统自带监听方法<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    @Override
    public void onClick(View v) {// 直接调用不会显示v被点击效果
        switch (v.getId()) {
            case R.id.llGRDB:
                startActivity(GetTodoListActivity.createIntent(context, "个人待办",
                        "TodoList"));
                break;
            case R.id.llDBRL:
                startActivity(GetTodoListActivity.createIntent(context, "待办认领",
                        "BackLog"));
                break;
            case R.id.llDYSY:
                startActivity(GetTodoListActivity.createIntent(context, "待阅事宜",
                        "MatterRead"));
                break;
            case R.id.llYBSY:
                startActivity(GetHasTodoListActivity.createIntent(context, "已办事宜",
                        "HadDone"));
                break;
            case R.id.llYYSY:
                startActivity(GetHasTodoListActivity.createIntent(context, "已阅事宜",
                        "HadRead"));
                break;
            case R.id.llKYSY:
                startActivity(GetHasTodoListActivity.createIntent(context, "可阅事宜",
                        "AllowRead"));
                break;
            case R.id.llYFQ:
                startActivity(GetHasMethodListActivity.createIntent(context, "已发起",
                        "hadstarted"));
                break;
            case R.id.llCBWJ:
                startActivity(GetHasMethodListActivity.createIntent(context,
                        "撤办文件", "undo"));
                break;
            case R.id.llLCYJ:
                startActivity(FlowTransferListActivity.createIntent(context,
                        "流程移交"));
                break;
            case R.id.llSXYJ:
                startActivity(MatterTransferListActivity.createIntent(context,"事项移交"));
                break;
            case R.id.llZZYJ:
                startActivity(GetHandWorkListActivity.createIntent(context, "正在移交",
                        "HandWorking"));
                break;
            case R.id.llYJ_YJS:
                startActivity(HandReceiveListActivity.createIntent(context,
                        "移交-已接收", "HadReceive"));
                break;
            case R.id.llYJ_BJJ:
                startActivity(HandRejectListActivity.createIntent(context,
                        "移交-被拒收", "RejectWork"));
                break;
            case R.id.llDJS:
                startActivity(ToReceiveListActivity.createIntent(context, "待接收",
                        "HandWorkWaitReceive"));
                break;
            case R.id.llJS_YJIES:
                startActivity(GetReceiveListActivity.createIntent(context,
                        "接收-已接收", "HandWorkHadReceive"));
                break;
            case R.id.llJS_YJUS:
                startActivity(ManageRejectListActivity.createIntent(context,
                        "接收-已拒收", "HandWorkRejectReceive"));
                break;
            case R.id.llGRDBSZ:
                startActivity(AgentSetListActivity.createIntent(context,
                        "个人代办设置", "person"));
                break;
            case R.id.llDBYJLB:
                startActivity(AgentTransferListActivity.createIntent(context, "代办移交列表",
                        "AgentTransfer"));
                break;
            case R.id.llDBLSJL:
                startActivity(GetAgentListActivity.createIntent(context, "代办历史记录",
                        "AgentRecord"));
                break;
            case R.id.llDBGZJS:
                startActivity(AgentReciveListActivity.createIntent(context, "代办工作接收",
                        "AgentReceive"));
                break;
            default:
                break;
        }
    }


}